#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
const int N=100010;
int n,m;
int q[N];
int main()
{
    scanf("%d%d",&n/*正数组长度*/,&m/*查询个数*/);
    for(int i=0;i<n;i++){
        scanf("%d",&q[i]);
    }
    while(m--)
    {
        int x=0;
        scanf("%d",&x);
        int left=0,right=n-1;
        while(left<right)
        {
            int mid=(left+right)>>1;
            if(q[mid]>=x)right=mid;
            else left=mid+1;
        }
        if(q[left]!=x)cout<<"-1 "<<"-1 "<<endl;
        else{
            cout<<left<<" ";
            int left=0,right=n-1;
            while(left<right)
            {
                int mid=(left+right+1)>>1;
                if(q[mid]<=x)left=mid;
                else right=mid-1;
            }
            cout<<left<<endl;
        }
    }
    return 0;
}